﻿using System;
using System.Collections.Generic;
using Xenta.Entities;

namespace Xenta.Plugins
{
    /// <summary>
    /// Exposes the shipping method interface.
    /// </summary>
    public interface IShippingMethod : IPlugin
    {
        /// <summary>
        /// Determines, if shipping is possible from the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns>true if shipping is possible; otherwise false.</returns>
        bool CanShipFrom(IAddress address);

        /// <summary>
        /// Determines, if shipping is possible to the specified address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns>true if shipping is possible; otherwise false.</returns>
        bool CanShipTo(IAddress address);

        /// <summary>
        /// Calculates shipping price.
        /// </summary>
        /// <param name="from">The sender address.</param>
        /// <param name="to">The recipient address.</param>
        /// <returns>The price.</returns>
        decimal CalcShippingPrice(IAddress from, IAddress to);

        /// <summary>
        /// Calculates shipping price.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <returns>The price.</returns>
        decimal CalcShippingPrice(OrderEntity order);

        /// <summary>
        /// Initializes the order shipping.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <param name="comment">When this method return, may contain an additional string comment.</param>
        /// <returns>The key-value pair collection.</returns>
        IDictionary<String, String> InitShipping(OrderEntity order, out string comment);

        /// <summary>
        /// Cancels the order shipping.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <param name="comment">When this method return, may contain an additional string comment.</param>
        /// <returns>The key-value pair collection.</returns>
        IDictionary<String, String> CancelShipping(OrderEntity order, out string comment);
    }
}
